import React from 'react'
import Tit from '../../components/Tit'
import './Expressage.less'
import { withRouter } from 'react-router-dom'
class Expressage extends React.Component {
    state = {
        Expre: null
    }
    componentDidMount() {
        console.log(this.props.match.params.id)
        this.$postData('/api/order/getExpressage', { orderId: this.props.match.params.id }, params => {
            console.log(params)
            switch (params.code) {
                case 100:
                    this.setState({
                        Expre: params.data
                    })
                    break;
                default:
                    this.Toast.info(params.msg);
                    break;
            }
        })
    }
    render() {
        return (
            <div><Tit zz={false} tit={'追踪物流'}></Tit>
                {this.state.Expre ? <div className='Expre-d1'>{
                    this.state.Expre.map((val, index) => (
                        <div className='Expre-d2' key={index}>
                            <div className='Expre-d3'>
                                <img src={index === 0 ? require('../../static/img/dingwei-red.png') : require('../../static/img/dingwei.png')} alt="" />
                                <img src={require('../../static/img/xuxian.png')} alt="" />
                            </div>
                            <div className='Expre-d4'>
                                <p className='Expre-p1'>{val.context}</p>
                                <p className={index === 0 ?'Expre-p2 Expre-p3':'Expre-p2'}>{val.ftime}</p>
                            </div>
                        </div>
                    ))}
                </div> : <div></div>}
            </div>
        )
    }
}

export default withRouter(Expressage)